using System;

namespace EventBehaviorTree
{
    public class BB_float : BBData<float>
    {
        public override Type GetDataType() { return typeof(float); }

        public BB_float(float value) : base(value)
        {
            _value = value;
        }
        public BB_float() : this(0) { }

        #region Compare
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            if (obj.GetType() != typeof(BB_int) || obj.GetType() != typeof(BB_float))
            {
                return false;
            }

            return ((BB_int)obj).GetValue() == _value || ((BB_float)obj).GetValue() == _value;
        }
        public override int GetHashCode()
        {
            return GetValue().GetHashCode();
        }

        public static bool operator ==(BB_float lhs, BB_float rhs)
        {
            return lhs.GetValue() == rhs.GetValue();
        }
        public static bool operator !=(BB_float lhs, BB_float rhs)
        {
            return !(lhs.GetValue() == rhs.GetValue());
        }
        public static bool operator >(BB_float lhs, BB_float rhs)
        {
            return lhs.GetValue() > rhs.GetValue();
        }
        public static bool operator <(BB_float lhs, BB_float rhs)
        {
            return lhs.GetValue() < rhs.GetValue();
        }
        public static bool operator >=(BB_float lhs, BB_float rhs)
        {
            return lhs.GetValue() >= rhs.GetValue();
        }
        public static bool operator <=(BB_float lhs, BB_float rhs)
        {
            return lhs.GetValue() <= rhs.GetValue();
        }
        #endregion
    }
}
